<script setup>
defineProps({
  list: {
    type: Array,
    default: () => []
  }
})

function handleClick(link) {
  navigateTo(link)
}
</script>

<template>
  <div>
    <ul class="nav-warp">
      <li v-for="(item, index) in list" :key="item.name" class="nav-item" :style="{ background: item.bgColor }" @click="handleClick(item.link)">
        <img class="w-20px h-20px ml-16px" :src="`/images/icon/nav/${item.icon}.png`" :alt="item.name" />
        <div class="nav-name" :class="`nav-name-active-${index}`">{{ item.name }}</div>
      </li>
    </ul>
  </div>
</template>

<style lang="scss" scoped>
.nav-warp {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  height: 356px;
  padding: 20px 0 0 40px;
  .nav-item {
    width: 144px;
    height: 40px;
    display: flex;
    align-items: center;
    margin: 0 10px 20px 0;
    border-radius: 8px;
    color: #111111;
    font-weight: bold;
    cursor: pointer;
    &:hover {
      background: #f0f5ff;
      border-radius: 8px;
      transition: 0.3s;

      .nav-name-active-0,
      .nav-name-active-4,
      .nav-name-active-7 {
        color: #ffa036;
      }

      .nav-name-active-1,
      .nav-name-active-3 {
        color: #21cec5;
      }

      .nav-name-active-2,
      .nav-name-active-5,
      .nav-name-active-8 {
        color: #88d076;
      }

      .nav-name-active-6 {
        color: #5bc5ff;
      }
    }

    .nav-name {
      margin-left: 10px;
    }
  }
}
</style>
